package inputDemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        //打开文件
        InputStream inputStream = new FileInputStream("d:/test.txt");
        while (true){
            //一个字节一个字节进行读取
            int i = inputStream.read();
            if (i == -1){
                //读取完毕
                break;
            }
            System.out.printf("0x%x ", i);
        }
        //关闭文件
        inputStream.close();
    }
}
